package com.gaogzhen.appScenarios.sellTicket;

/**
 * @author Administrator
 * @version 1.0
 * @description 售票窗口
 * @date 2022-10-14 09:50
 */
public class TicketWindow {
    private int count;

    public TicketWindow(int count) {
        this.count = count;
    }

    /**
     * 获取剩余票数
     * @return  剩余票数
     */
    public int getCount() {
        return count;
    }

    /**
     * 售票
     * @param amount    售票数
     * @return          实际售票数
     */
    public int sell(int amount) {
        if (count >= amount) {
            count -= amount;
            return amount;
        } else {
            return 0;
        }
    }
}
